package com.minisoft.rmi;

import com.sun.jndi.rmi.registry.ReferenceWrapper;

import javax.naming.Reference;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;

/**
 * @author JueSu
 * @description: TODO
 * @date 2021/12/12 15:31
 */
public class RMIServer {
    public static void main(String[] args) throws Exception {
        LocateRegistry.createRegistry(1099);
        Registry registry = LocateRegistry.getRegistry();
        System.out.println("Create RMI registry on port 1099");

        Reference refer = new Reference("com.minisoft.rmi.SomeObject","com.minisoft.rmi.SomeObject","http://127.0.0.1:80/");
        ReferenceWrapper wrapper = new ReferenceWrapper(refer);
        registry.bind("obj",wrapper);
    }
}
